/**
 * 防快速双击的状态装饰器
 */
let maskAsyncStatus = false;
export const MaskAsync = function handleDescriptor(target, key, descriptor) {
	const fn = descriptor.value;
	return {
		...descriptor,
		async value() {
			if (!maskAsyncStatus) {
				maskAsyncStatus = true;
				console.log('[mask]START-----', maskAsyncStatus);
				try {
					await fn.apply(this, arguments);
				} catch (e) {
					console.error(e);
				} finally {
					maskAsyncStatus = false;
					console.log('[mask]END-----', maskAsyncStatus);
				}
			}
		}
	};
};
